var TileFactory = [
	null,
	
	{solid: 1}, // Simple wall
	
	{ // Door
		solid: 2,
		drawFront: function(distance, renderH, mapManager){
			var x1, y1, x2, y2, s;
		
			s = mapManager.distScale[distance];
			x1 = renderH.a - (100 * s);
			y1 = renderH.b - (100 * s);
			x2 = renderH.a + (100 * s);
			y2 = renderH.b + (renderH.b * s);
			
			var game = mapManager.game;
			game.drawLine(x1,y1,x2,y1);
			game.drawLine(x1,y1,x1,y2);
			game.drawLine(x2,y1,x2,y2);
		},
		drawLateral: function(distance, renderH, position, mapManager){
			var x1, y1, x2, y2, y3, y4, s1, s2;
		
			s1 = mapManager.distScale[distance];
			s2 = mapManager.distScale[distance + 1];
			
			x1 = renderH.a + ((renderH.a - 50) * s1 * position);
			y1 = renderH.b - ((renderH.b - 60) * s1);
			x2 = renderH.a + ((renderH.a + 50) * s2 * position);
			y2 = renderH.b - ((renderH.b - 40) * s2);
			y3 = renderH.b + ((renderH.b - 25) * s1);
			y4 = renderH.b + ((renderH.b + 25) * s2);
			
			var game = mapManager.game;
			game.drawLine(x2,y4,x2,y2);
			game.drawLine(x2,y2,x1,y1);
			game.drawLine(x1,y1,x1,y3);
		}
	},
	
	{ // CellBar
		solid: 1,
		desc: "Cell Bars",
		drawFront: function(distance, renderH, mapManager){
			var x, y1, y2, s;
		
			s = mapManager.distScale[distance];
			x = renderH.a - (renderH.a * s);
			y1 = renderH.b - (renderH.b * s);
			y2 = renderH.b + (renderH.b * s);
			
			var game = mapManager.game;
			for (var i=0;i<11;i++){
				x += 53 * s;
				game.drawLine(x,y1,x,y2);
			}
		},
		drawLateral: function(distance, renderH, position, mapManager){
			var x, y1, y2, s;
		
			s = mapManager.distScale[distance];
			
			x = renderH.a + (renderH.a * s * position);
			y1 = renderH.b - (renderH.b * s);
			y2 = renderH.b + (renderH.b * s);
			
			var game = mapManager.game;
			for (var i=0;i<5;i++){
				x -= (27 * s * position);
				y1 += (14 * s);
				y2 -= (14 * s);
				
				game.drawLine(x,y1,x,y2);
			}
		}
	},
	
	{ // Weak Wall
		solid: 1,
		desc: "old brick wall",
		drawFront: function(distance, renderH, mapManager){
			var x1, x2, x3, x4, x5, y1, y2, y3, y4, s;
		
			s = mapManager.distScale[distance];
			x1 = renderH.a - (100 * s);
			x2 = renderH.a + (100 * s);
			x3 = renderH.a;
			x4 = renderH.a - (70 * s);
			x5 = renderH.a + (70 * s);
			
			y1 = renderH.b;
			y2 = renderH.b + (60 * s);
			y3 = renderH.b - (40 * s);
			y4 = renderH.b + (100 * s);
			
			var game = mapManager.game;
			game.drawLine(x1,y1,x2,y1);
			game.drawLine(x1,y2,x2,y2);
			game.drawLine(x3,y1,x3,y2);
			game.drawLine(x4,y3,x4,y1);
			game.drawLine(x5,y3,x5,y1);
			game.drawLine(x4,y2,x4,y4);
			game.drawLine(x5,y2,x5,y4);
		},
		drawLateral: function(distance, renderH, position, mapManager){
			var x1, x2, y1, y2, y3, y4, s;
		
			var game = mapManager.game;
			var rh = renderH;
			s = mapManager.distScale[distance];
			
			x1 = rh.a + ((rh.a - 40) * s * position);
			x2 = rh.a + ((rh.a - 110) * s * position);
			y1 = rh.b + (5 * s);
			y2 = rh.b + (10 * s);
			y3 = rh.b + (65 * s);
			y4 = rh.b + (50 * s);
			
			game.drawLine(x1,y1,x2,y2);
			game.drawLine(x1,y3,x2,y4);
			
			x1 = rh.a + ((rh.a - 75) * s * position);
			y1 = rh.b + (8 * s);
			y2 = rh.b + (58 * s);
			
			game.drawLine(x1,y1,x1,y2);
			
			x1 = rh.a + ((rh.a - 55) * s * position);
			y1 = rh.b - (20 * s);
			y2 = rh.b + (5 * s);
			y3 = rh.b + (60 * s);
			y4 = rh.b + (85 * s);
			
			game.drawLine(x1,y1,x1,y2);
			game.drawLine(x1,y3,x1,y4);
			
			x1 = rh.a + ((rh.a - 95) * s * position);
			y1 = rh.b - (15 * s);
			y2 = rh.b + (8 * s);
			y3 = rh.b + (55 * s);
			y4 = rh.b + (75 * s);
			
			game.drawLine(x1,y1,x1,y2);
			game.drawLine(x1,y3,x1,y4);
		}
	}
];
